
pkgname=tcl
pkgver=8.6.8
_pkgver=8.6
pkgrel=1
pkgdesc="The Tcl scripting language"
arch=('x86_64')
url="http://tcl.sourceforge.net/"
license=('custom')
depends=('glibc' 'zlib')
source=("https://downloads.sourceforge.net/sourceforge/tcl/tcl${pkgver}-src.tar.gz")
md5sums=('81656d3367af032e0ae6157eff134f89')

build() {
  cd tcl${pkgver}/unix
  # Already in sqlite3:
  rm -rf ${srcdir}/tcl${pkgver}/pkgs/sqlite3*

  ./configure --prefix=/usr --mandir=/usr/share/man --enable-threads --enable-64bit
  
  make
  
  # LFS recommendation http://www.linuxfromscratch.org/blfs/view/svn/general/tcl.html
  sed -e "s@^\(TCL_SRC_DIR='\).*@\1/usr/include'@" \
      -e "/TCL_B/s@='\(-L\)\?.*unix@='\1/usr/lib@" \
      -i tclConfig.sh
}

check() {
  cd tcl${pkgver}/unix
  
  #make test
}

package()
{
  cd tcl${pkgver}/unix
  
  make INSTALL_ROOT=${pkgdir} install install-private-headers
  ln -sf tclsh${_pkgver} ${pkgdir}/usr/bin/tclsh
  
  install -Dm644 ../license.terms ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
